#ifndef PLAYER_HH_
#define PLAYER_HH_
#include "World.hh"
#include "Fleet.hh"
#include "../Geom/Vector.hh"

class World::Player {
    public: static spPlayer construct(spGalaxy galaxy, spUser user);

    protected: mutable QMutex lock;

    protected: wpGalaxy const galaxy;

    protected: wpUser const user;

    protected: FleetMap fleets;

    protected: u8 fleetId;

    protected: u8 money;

    public: Player(spGalaxy galaxy, spUser user);

    protected: spPlayer self() const;

    public: void next_turn();

    public: i8 transaction(i8 amount, bool allRequired = false);

    public: spFleet add_fleet(
      Geom::Vector<> const& position,
      u8 battleship = 0,
      u8 fighter = 0,
      u8 transportship = 0,
      u8 colonyship = 0,
      u8 tank = 0
    );
    public: void del_fleet(FleetMap::key_type id);
    public: spFleet get_fleet(FleetMap::key_type id) const;
    public:
    spFleet
    get_closest_fleet(Geom::Vector<> const& position, f8 limit = 1) const;

    public: QString  get_name()   const;
    public: spGalaxy get_galaxy() const;
    public: spUser   get_user()   const;
    public: FleetMap get_fleets() const;
    public: u8       get_money()  const;
};

#endif // ndef PLAYER_HH_
